Repository navigation
chore: refuse commits and pushes whose identity matches the private denylist - #615
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
.githooks/identity-scan.sh, which matches commit author and committer name and email against the private denylist. It uses the same denylist source and the same allowed-address stripping as the content scan.stagedmode checks the identity git would record for a new commit.rangemode prints only the SHAs of matching commits..githooks/pre-commitruns thestagedcheck, and.githooks/pre-pushruns therangecheck on each pushed ref before the TypeScript gate. The identity check ignoresSKIP_TS_TYPECHECK, and--no-verifystill skips it. Pre-push reads the pushed refs once and reuses them for the TypeScript gate..githooks/leak-patterns.shis also sourced byidentity-scan.sh.CONTRIBUTING.mdand.githooks/deny-list.exampledocument the guard and note that hosted CI cannot see the private denylist.scripts/leak-scan.test.tsadds tests for the staged, range, and pre-push paths.Validation
Risk Assessment
✅ Low: Local-hook-only change that meets the intent: pre-commit blocks a denylisted author/committer identity and pre-push scans each outgoing range. Round-1 fixes check out: an unresolvable range now blocks, the case-insensitive sed flag is gone, and pre-push has behavioural tests with fixture repos.
Testing
Drove the identity guard live through real git. Commit-time refusals (author, committer) and push-time refusals (new branch, update, SKIP_TS_TYPECHECK does not bypass) all blocked as intended, and clean identities passed. The fail-closed unresolvable-range case and the denylisted-name-beside-allowed-address case also blocked. The focused leak-scan test file passed (15/15). Baseline broad regression came from the configured test command
scripts/ci-local.sh --affected --strict-toolchains, which passed at this target commit and was not re-run. Overall result: pass, with no findings.Evidence: Commit-time identity guard transcript (real git commit, pre-commit hook)
Evidence: Push-time identity guard transcript (real git push, pre-push hook, fail-closed case)
Evidence: Adversarial identity transcript (name beside allowed address, clean commits)
Evidence: Focused test run: scripts/leak-scan.test.ts (15 pass)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 3 issues found → auto-fixed ✅
.githooks/identity-scan.sh:49- The pre-push identity guard fails open.git log ... 2>/dev/nullswallows every error, and the loop at identity-scan.sh:49 then sees no commits and the script exits 0. Failing sequence: a force-push where the remote sha is not present locally.range "$remotesha..$localsha"errors on the unknown object, nothing is printed, and tainted commits push. A bad range also passes silently. The guard exists to stop exactly the leaked-identity push, so an unresolvable range should block, or at least warn. Fix: check thegit logexit status (for examplegit rev-listfirst) and return 1 with a message when it fails. The--not --remotesbranch at pre-push:36 has the same silent-pass behaviour ifgit logerrors..githooks/identity-scan.sh:28-sed -E "s/$LEAK_ALLOW//Ig"uses theIflag ons///. GNU sed accepts it. BSD/macOS sed rejects it with "bad flag in substitute command". The repo explicitly supports macOS (/Users/pattern). On such a machine sed prints nothing,grep -qfinds no match,matchesreturns 1 for every identity, and both hooks pass silently. Use a portable approach, for examplegrep -oiEorawkwithtolower, or drop the vestigial allow-strip. LEAK_ALLOW itself is described as vestigial in leak-patterns.sh. Stripping it also lets a denylisted name pass when it sits beside the allowed address in the same identity.scripts/leak-scan.test.ts:90- The pre-push wiring has no behavioural test. Its stdin parsing, the new-branch--not --remotespath, theremotesha..localshapath and the exit-before-TS-gate ordering are untested. The pre-push edit is also wheredone <<< "$_PUSH_REFS"changed how the existing TS gate reads its input, which is a regression risk. The new tests invokeidentity-scan.sh rangedirectly and never run.githooks/pre-pushwith ref lines on stdin. Add a test that feeds ref lines to pre-push in a fixture repo with a tainted commit. Cover a new branch (zero remote sha) and an update, and assert exit 1. A plausible wrong behaviour it would reject: the guard being skipped for new branches, or an argument-order bug in therangecall.🔧 Fix applied.
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --affected --strict-toolchainsBaseline (already ran, not re-run):scripts/ci-local.sh --affected --strict-toolchainspassed at 14d628fea. No source or test files changed in this turn, so no re-run.Scenario 1 (commit guard): disposable repo at a scratch path, hooks copied to.githooks/withcore.hooksPathset, synthetichooks.denyListPathcontainingacmecorpandacme-abbr. Ran realgit commitwith denylisted author email, denylisted committer name only, and clean identity.Scenario 2 (push guard): same fixture with a local bare remote. Ran realgit pushof a new branch carrying a denylisted-author commit (blocked, remote unchanged), a new clean branch (passes with SKIP_TS_TYPECHECK=1), an update adding a denylisted committer (blocked), and the tainted branch again with SKIP_TS_TYPECHECK=1 (still blocked).Scenario 2e (adversarial, fail closed): fed.githooks/pre-pusha ref line whose remote sha is absent locally; expected and observed exit 1 with 'cannot list the commits'.Scenario 3 (adversarial): denylisted name ACMECORP beside allowed address doug@dougmealing.com in the same author identity, committed with realgit commit; blocked. Allowed address with a clean name, and clean identity, both committed.bun test scripts/leak-scan.test.tsfrom the worktree root: 15 pass, 0 fail (identity scan, range, and pre-push wiring tests).Evidence transcripts: s1-commit-guard.txt, s2-push-guard.txt, s3-adversarial-identity.txt, leak-scan-test.txt. Disposable fixture removed afterwards; worktree left clean; no background jobs started.Scope note, not a finding: a commit message that mentions the denylisted name with a clean identity still commits (exit 0). The intent covers only author and committer identity, so this is correct.⏭️ **Document** - skipped
AGENTS.md:98- AGENTS.md (agent memory, human-owned) describes the pre-commit hygiene hook but not the new author/committer identity check, and the pre-push bypass note does not say the identity guard survives SKIP_TS_TYPECHECK. Not factually wrong, so left unchanged per the AGENTS.md edit rule. Human decision whether to add one line.docs/RELEASING.md:992- Public-repo hygiene prose is duplicated across AGENTS.md, CONTRIBUTING.md and docs/RELEASING.md, and each copy now describes the hooks differently. Out-of-scope follow-up: keep the hook behaviour in CONTRIBUTING.md (contribution-mechanics owner) and reduce the other two to pointers.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.